#include<stdio.h>
#include<unistd.h>
int global = 100;
int main()
{
	pid_t id = fork();
	if(id == 0)
	{
		//进入子进程；
		int cnt = 5;
		while(1)
		{
			if(cnt)
			{
				cnt--;
			}
			else
			{
				global = 200;
			}
			printf("child:pid:%d global:%p,  %d\n",getpid(),&global,global);
			sleep(1);
		}
	}
	else if(id > 0)
	{
		while(1)
		{

			printf("parent:pid:%d global:%p  %d\n",getpid(),&global,global);
			sleep(1);
		}

	
	}
	return 0;
}
